<!--公共头部-->
{template 'aitimt/common/header'}
	<style>
		.mui-input-row{overflow: unset;}
		.mui-search input[type=search] {background-color: #EFEFEF;width: 80%;border-radius: 3.125rem;border: 1px #eee solid;height: 2.5625rem;}
		.top-slider{z-index: 15;margin-top:15% ;overflow: unset;}
		.top-slider .mui-slider-group .mui-slider-item img{width: 100%;}
		.mui-indicator .mui-active{background-color:#000000;}
		.mui-search .mui-placeholder{color: #595757;line-height: 2.5rem;font-size: 0.9375rem;width: 45%;}
		.mui-segmented-control.mui-segmented-control-inverted .mui-control-item.mui-active{color: #585858;border-bottom: 0;}
		.mui-bar-tab .mui-tab-item.mui-active{color: #ea4609;}
		.mui-bar-nav~.mui-content{margin-bottom: 10%;margin-top: 5%;}
		.mui-table-view .mui-media-object{max-width: 40%;}
		.mui-content{background-color: #FFFFFF;}
		.mui-slider{background-color: #efefef;}
		.mui-slider-indicator.mui-segmented-control .mui-control-item {padding: 1px;border-left:1px solid #c1c1c1 ;color: #585858;}
		.mui-slider .mui-segmented-control.mui-segmented-control-inverted .mui-control-item.mui-active{border-bottom:3px solid #e94709 ;color: #585858;}
		.mui-table-view-cell img{max-width: 100%;width: 20%;float: right;}
		.mui-card{color: #595757;font-size: 15px;margin: 0;margin-top: 10%;box-shadow:none;}
		.my-data{float: right;margin-right: 10%;}
		.mui-table-view-chevron{background-color: #EEEEEE;}
		.mui-collapse{background-color: #FFFFFF;}
		.mui-navigate-right img{float: right;}
		.mui-table-view-cell.mui-active, .mui-table-view-cell>a:not(.mui-btn).mui-active{background-color: #FFFFFF;}
		.mui-icon-forward{position: absolute;top: 35%;right: 5%;}
		#offCanvasSideScroll{background-color: #ffffff;margin-top: 15%;}
		.mui-off-canvas-wrap .mui-inner-wrap{background-color: #EEEEEE;}
		.mess{width: 100%;background: #ffffff;padding: 2% 5%;margin: 0;border-bottom: 1px solid #eeeeee;}
		.mui-input-row label{width: 25%;padding: 11px 0 11px 15px}
		.mui-input-row label~input, .mui-input-row label~select, .mui-input-row label~textarea{width: 75%}
		.mui-bar .mui-btn-block{border: 0;background: #e94709}
		.formBtn{width: 20%;margin-bottom: 4%;font-size: 10px; border-radius: 20px;}
		.formBtn-active{color: white;background: #E94709;}
		.mui-switch:before{font-size: 11px;line-height: 17px;right: 0;}
		.mui-table-view-cell>.mui-switch{height: 26px;right: 50px;width: 50px;}
		.mui-switch .mui-switch-handle{height: 23px;width: 25px;}
		.mui-switch.mui-active:before{right: auto;left: 0;}
		.mui-table-view-cell:after{height: 0;}
		.buttomBtn{padding: 0 10%;width: 100%; background:#EEEEEE;padding-top: 2%;border-top: 10px solid #eee;}
		.buttomEdit{text-align: center;padding: 10px 46%;font-size: 15px;color: white;background: #ff6f02;}
		.remarks{float: left;padding-left: 2%;width: 100%; background:#EEEEEE;padding-top: 2%;border-top: 10px solid #eee;}
	</style>
	<header class="mui-bar mui-bar-nav">
		<a class="top-return" onclick="myreturn()"><img src="{$aideUrl}app/resource/aitimt/images/return.png" ></a>
		<a class="top-logo"><img src="{$aideUrl}app/resource/aitimt/images/logo.png" ></a>
		<!--公共菜单start -->
		{template 'aitimt/common/menu'}
		<!-- 公共菜单end-->
	</header>
<!--侧滑菜单容器-->
	<div class="mui-inner-wrap">
		<div class="mui-card">
		<ul class="mui-table-view mui-table-view-chevron">
			<div class="remarks">
				{loop  $formList $k $form}
				<button type="button" class="formBtn {if $formItem['id']==$form['id']}formBtn-active{/if}" onclick="formChange({$form['id']})">
					{$form['remarks']}
				</button>
				{/loop}
				<button type="button" class="formBtn" style="border:1px dashed #8c8ee5;" onclick="edit(0)" >
					添加参赛人
				</button>
			</div>
				<div id="message">
					<li class="mui-table-view-cell" style="background: white;padding: 10px;">
					<span>设置为本人</span><br>
					<span style="font-size: 10px;color: #E5E5E5">设置后据此人信息推送比赛及相关信息</span>
					<div class="mui-switch {if $formItem['status']==2}mui-active{/if}" >
						<div class="mui-switch-handle"></div>
						</div>
					</li>
					<p class="mess" style="margin-top: 10px;">昵称<span class="my-data">{if $formItem['remarks']}{$formItem['remarks']}{else}未填写{/if}</span></p>
					<p class="mess">姓名<span class="my-data">{if $formItem['realname']}{$formItem['realname']}{else}未填写{/if}</span></p>
					<p class="mess">手机<span class="my-data">{if $formItem['mobile']}{$formItem['mobile']}{else}未填写{/if}</span></p>
					<p class="mess">性别<span class="my-data">{if $formItem['gender']==1}男{elseif $formItem['gender']==2}女{else}未填写{/if}</span></p>
					<p class="mess">证件号码<span class="my-data">{if $formItem['idcard']}{$formItem['idcard']}{else}未填写{/if}</span></p>
					<p class="mess">出生日期<span class="my-data">{if $formItem['birthyear']>0}{$formItem['birthyear']}-{$formItem['birthmonth']}-{$formItem['birthday']}{else}未填写{/if}</span></p>
					<p class="mess">电子邮箱<span class="my-data">{if $formItem['email']}{$formItem['email']}{else}未填写{/if}</span></p>
					<p class="mess">省市区<span class="my-data">{if $formItem['resideprovince']}{$formItem['resideprovince']}-{$formItem['residecity']}-{$formItem['residedist']}{else}未填写{/if}</span></p>
					<p class="mess">联系地址<span class="my-data">{if $formItem['address']}{$formItem['address']}{else}未填写{/if}</span></p>
					<p class="mess">血型<span class="my-data">{if $formItem['bloodtype']}{$formItem['bloodtype']}{else}未填写{/if}</span></p>
					<p class="mess">衣服尺寸<span class="my-data">{if $formItem['size']}{$formItem['size']}{else}未填写{/if}</span></p>
					<p class="mess">学历<span class="my-data">{if $formItem['education']}{$formItem['education']}{else}未填写{/if}</span></p>
					<p class="mess">紧急联系人<span class="my-data">{if $formItem['emerperson']}{$formItem['emerperson']}{else}未填写{/if}</span></p>
					<p class="mess">紧急联系人手机<span class="my-data">{if $formItem['emerphone']}{$formItem['emerphone']}{else}未填写{/if}</span></p>
					<p class="mess">一年内完赛证书<br><br>
					<img src="{if $formItem['certificate']}{$formItem['certificate']}{else}{$aideUrl}app/resource/aitimt/images/positive.png{/if}" width="100">
					</p>
					<p class="mess">体检证明<br><br>
					<img src="{if $formItem['report']}{$formItem['report']}{else}{$aideUrl}app/resource/aitimt/images/positive.png{/if}" width="100">
					</p>
					<div class="bottomBtn">
					<button type="button" class="buttomEdit"  onclick="edit({$formItem['id']})"  >
					编辑
					</button>
					</div>



			</div>


		</ul>
	</div>
	</div>
	<script type="text/javascript">
    mui.init({
        swipeBack: false,
    });
    localStorage.setItem('fid',{$formItem['id']});
  function edit(id) {
      location.href = "{php echo app_url('home/index/mycommon')}&edit=1&fid="+id;
  }
    $('.remarks button').click(function(){
        $(this).addClass('formBtn-active').siblings().removeClass("formBtn-active");
    });
    mui('.mui-switch').each(function() { //循环所有toggle
        this.addEventListener('toggle', function(event) {
            if (event.detail.isActive){
                mui.toast('开启成功');
                setStatus(localStorage.getItem('fid'),2);
            }else{
                mui.toast('关闭成功');
                setStatus(localStorage.getItem('fid'),1);
            }
        });
    });
    function setStatus(fid,status) {
        $.ajax({
            type: 'post',
            url: "{php echo app_url('home/index/setStatus')}",
            data: {fid:fid,status:status},
            dataType: 'json',
            success: function(data){
            },
            error: function(xhr, type){
            }
        });
    }
    function myreturn() {
        location.href = "{php echo app_url('home/index/my')}";
    }
  function formChange(id) {
              $.ajax({
                  type: 'post',
                  url: "{php echo app_url('home/index/mycommon')}",
                  data: {fid:id},
                  dataType: 'json',
                  success: function(data){
                      var result='',chabox='';
                      if (data.id!=null){
                          localStorage.setItem('fid',data.id);
                          data.remarks=data.remarks?data.remarks:'未填写';
                          data.realname=data.realname?data.realname:'未填写';
                          data.mobile=data.mobile?data.mobile:'未填写';
                          data.gender=data.gender>0?(data.gender==1?'男':'女'):'未填写';
                          data.idcard=data.idcard?data.idcard:'未填写';
                          data.birth=data.birthyear>0?data.birthyear+'-'+data.birthmonth+'-'+data.birthday:'未填写';
                          data.email=data.email?data.email:'未填写';
                          data.reside=data.resideprovince?data.resideprovince+'-'+data.residecity+'-'+data.residedist:'未填写';
                          data.address=data.address?data.address:'未填写';
                          data.bloodtype=data.bloodtype?data.bloodtype:'未填写';
                          data.size=data.size?data.size:'未填写';
                          data.education=data.education?data.education:'未填写';
                          data.emerperson=data.emerperson?data.emerperson:'未填写';
                          data.emerphone=data.emerphone?data.emerphone:'未填写';
                          data.certificate=data.certificate?data.certificate:'{$aideUrl}app/resource/aitimt/images/positive.png';
                          data.report=data.report?data.report:'{$aideUrl}app/resource/aitimt/images/positive.png';
                          data.education=data.education?data.education:'未填写';
						  if (data.status==2){
						      chabox='<div class="mui-switch mui-active">\n';
						  } else {
                              chabox='<div class="mui-switch">\n';
						  }

                          result='<li class="mui-table-view-cell" style="background: white;padding: 10px;">\n' +
                              '<span>设置为本人</span><br>\n' +
                              '<span style="font-size: 10px;color: #E5E5E5">设置后据此人信息推送比赛及相关信息</span>\n' +
                              chabox +
                              '<div class="mui-switch-handle"></div>\n' +
                              '</div>\n' +
                              '</li>\n';
                          result+=' <p class="mess" style="margin-top: 10px;">昵称<span class="my-data">'+data.remarks+'</span></p>\n' +
                              '   <p class="mess">姓名<span class="my-data">'+data.realname+'</span></p>\n' +
                              '   <p class="mess">手机<span class="my-data">'+data.mobile+'</span></p>\n' +
                              '   <p class="mess">性别<span class="my-data">'+data.gender+'</span></p>\n' +
                              '   <p class="mess">证件号码<span class="my-data">'+data.idcard+'</span></p>\n' +
                              '   <p class="mess">出生日期<span class="my-data">'+data.birth+'</span></p>\n' +
                              '   <p class="mess">电子邮箱<span class="my-data">'+data.email+'</span></p>\n' +
                              '   <p class="mess">省市区<span class="my-data">'+data.reside+'</span></p>\n' +
                              '   <p class="mess">联系地址<span class="my-data">'+data.address+'</span></p>\n' +
                              '   <p class="mess">血型<span class="my-data">'+data.bloodtype+'</span></p>\n' +
                              '   <p class="mess">衣服尺寸<span class="my-data">'+data.size+'</span></p>\n' +
                              '   <p class="mess">学历<span class="my-data">'+data.education+'</span></p>\n' +
                              '   <p class="mess">紧急联系人<span class="my-data">'+data.emerperson+'</span></p>\n' +
                              '   <p class="mess">紧急联系人手机<span class="my-data">'+data.emerphone+'</span></p>\n' +
                              '   <p class="mess">一年内完赛证书<br><br>\n' +
                              '   <img src='+data.certificate+' width="100">\n' +
                              '   </p>\n' +
                              '   <p class="mess">体检证明<br><br>\n' +
                              '   <img src='+data.report+' width="100">\n' +
                              '   </p>\n' +
                              '   <div class="bottomBtn">\n' +
                              '    <button type="button" class="buttomEdit" onclick="edit('+data.id+')" >\n' +
                              '     编辑\n' +
                              '    </button>\n' +
                              '   </div>';
                          document.getElementById('message').innerHTML=result;
                          //添加后执行
                          mui(".mui-switch").switch();
                          mui('.mui-switch').each(function() { //循环所有toggle
                              this.addEventListener('toggle', function(event) {
                                  if (event.detail.isActive){
                                      mui.toast('开启成功');
                                      setStatus(localStorage.getItem('fid'),2);
                                  }else{
                                      mui.toast('关闭成功');
                                      setStatus(localStorage.getItem('fid'),1);
                                  }
                              });
                          });

                      }else {
                          console.log('加载失败')
                      }
                  },
                  error: function(xhr, type){
                      // alert('加载失败，请刷新下重试!');
                      // 即使加载出错，也得重置
                      console.log('加载失败')
                  }
              });

          }
</script>

</body>

</html>
